{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import nltk\n",
    "import re\n",
    "import os\n",
    "import codecs\n",
    "from sklearn import feature_extraction\n",
    "import mpld3\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['u\\'(CNN) The synthetic cannabinoids often called \"fake weed\" are a mix of chemicals sprinkled on what looks like incense and sold in shiny packages, often to teens and young adults.\\\\n\\\\nIt produces sensations similar to tetrahydrocannabinol (THC), the psychoactive ingredient in the cannabis plant, yet many users report more powerful, often dangerous effects.\\\\n\\\\nNew research from the Centers for Disease Control and Prevention says young people who use fake weed are also more likely to use other drugs or alcohol, to behave violently and to have high-risk sex, according to a study published Monday in the journal Pediatrics\\\\n\\\\nTo understand the overall behavior of fake weed users, Heather Clayton, lead researcher of the new study and a health scientist in the CDC\\\\\\'s Division of Adolescent and School Health, turned to the 2015 Youth Risk Behavior Survey, a school-based anonymous questionnaire administered to a nationally representative sample of high school students.\\\\n\\\\nA total of 15,624 students in grades nine through 12 reported their behavior in four domains: substance use, injury and violence, mental health and sexual health.\\\\n\\\\n\"We learned from the 2015 Youth Risk Behavior Survey that nearly one in 10 high school students had used synthetic marijuana at some point in their lifetime,\" Clayton said.\\\\n\\\\nOf these students, nearly all reported that they had also used marijuana at least once. They were more likely to use marijuana very early in life -- before the age of 13 -- compared with students who had only ever used marijuana, according to Clayton.\\\\n\\\\nSexual risk-taking\\\\n\\\\nAlmost two-thirds of the surveyed students said they\\\\\\'d never used marijuana or synthetic cannabinoids.\\\\n\\\\nBut nearly a third of the students reported trying or routinely using marijuana, while about 23% of these students had also tried or used fake weed.\\\\n\\\\nDigging deeper into the data, Clayton and her colleagues discovered that students partial to synthetic cannabinoids were significantly more likely to perform risky sexual behaviors compared with students who limited themselves to marijuana.\\\\n\\\\nFor instance, compared with just 2% of nonusing teens and about 5% of marijuana-using teens, nearly 15% of fake weed-using teens had their first sexual intercourse before age 13. And about 38% of these same teens had had intercourse with four or more people, compared with just 3% of the nonusers and 20% of the students using cannabis.\\\\n\\\\nViolence was also more prevalent among teens partial to fake weed. A third of fake weed users had carried a weapon, compared with 12% of nonusers and about 19% of weed users. Meanwhile, more than half of fake weed users had been in physical fights and a quarter drove while drinking, compared with nonusers (15% and 2%, respectively) and weed users (29% and 12%, respectively).\\\\n\\\\n\"The findings indicate that students who report using synthetic marijuana are possibly on a very concerning health trajectory, which is particularly serious given that synthetic marijuana use is relatively common among adolescents,\" Clayton said.\\\\n\\\\nBased on the research, she and her colleagues believe school programs and health professionals should feature not only marijuana but synthetic cannabinoids in their prevention strategies.\\\\n\\\\nDepression and other risk factors\\\\n\\\\nPackages labeled as a safe and \"natural\" blend of herbs may give a false impression that the drug is a safe alternative to marijuana. Yet fake weed has caused rapid pulse, lethargy, nausea, vomiting, agitation, chest pain, hallucinations, delusions, confusion and dizziness, according to poison center reports.\\\\n\\\\nThe most severe effects reported include seizures, permanent cardiovascular damage, liver damage, stroke, psychosis, paranoia, aggression, anxiety attacks, dependence and death through overdose, suicide or an extreme negative reaction.\\\\n\\\\nWith so many obvious dangers, Andrew Ninnemann, a doctoral student in the clinical psychology program at the University of Maryland, designed a separate study, also published Monday in the journal Pediatrics , to understand the risk factors that contribute to a teen using fake weed.\\\\n\\\\nNinnemann and his colleagues recruited nearly a thousand students from seven public schools in Texas to participate in a survey in 2011, with follow-up questions approximately one year later. At the start of the survey, most participants were enrolled in the 10th or 11th grades. Ethnically diverse, 31% of the teens were African-American, 29% were white, 28% were Hispanic, and 12% categorized themselves as \"other.\"\\\\n\\\\nAnalysis of the data showed that African-American teens and females were less likely to use fake weed than males and teens of other ethnicities.\\\\n\\\\nSymptoms of depression, alcohol use, marijuana use and fake weed use predicted using fake weed one year later. However, teens with symptoms of anxiety or impulsivity were not likely to report using fake weed later.\\\\n\\\\nThe results indicate that using marijuana may increase the risk of fake weed use -- but not vice versa.\\\\n\\\\n\"This suggests that synthetic cannabinoid use should not necessarily be thought of as a risk factor for eventual marijuana use but instead may be a risk factor for those adolescents who engage in marijuana use already,\" Ninnemann said.\\\\n\\\\n\\\\\\'Unpredictable reactions\\\\\\' to a changing substance\\\\n\\\\n\"Teens who use synthetic cannabinoids, really, it\\\\\\'s playing a game of Russian roulette,\" said Dr. Robert Glatter, an emergency physician at Lenox Hill Hospital in New York City.\\\\n\\\\n\"Typically, they become very aggressive and violent in the ER, and often they require chemical (sedation) if not physical restraint.\"\\\\n\\\\nThe reaction of each user is \"unpredictable,\" Glatter said. \"We\\\\\\'ve had people with seizures requiring airway management and intubation. Other times, they can smoke it and become a little violent, seize once, and that\\\\\\'s it. In other cases, they can become a little violent, a little agitated, and that\\\\\\'s it. They wake up in a few hours.\"\\\\n\\\\nMostly, though, because they are \"flailing around\" and become violent and aggressive, the main issue is that they can injure the staff and themselves.\\\\n\\\\n\"Luckily, we haven\\\\\\'t been seeing a whole lot of it in the last six to 12 months. It\\\\\\'s kind of quieted down,\" Glatter said. \"A few years ago, we were seeing several cases a week.\" Still, he said, it\\\\\\'s likely to pop up again.\\\\n\\\\n\"People talk about getting it in bodegas, head shops, gas stations ... or they buy it from a friend.\"\\\\n\\\\nUsers find it difficult to gauge how much is too much, because once a fake weed formula is recognized, it will be outlawed, but then the producers will quickly change the chemical formula to keep one step ahead of the law.\\\\n\\\\n\"This is dangerous and unpredictable, and it can kill you,\" Glatter said. \"Using marijuana, which I\\\\\\'m not condoning, is safer. We don\\\\\\'t see the violent behavior or the seizure aspect we see with this drug.\"\\\\n\\\\nWhat parents need to know\\\\n\\\\nAccording to Dr. Scott Krakower, assistant unit chief for psychiatry at Zucker Hillside Hospital in Glen Oaks, New York, parents often ask him whether their teens might be doing permanent damage to their brains.\\\\n\\\\n\"It\\\\\\'s a tough question,\" he said. \"There is a possibility you can alter the neuro circuitry just from ingesting some of these agents. ... There could be some sustained injury.\"\\\\n\\\\nIt\\\\\\'s more likely, he said, that with treatment and help, the brain may be able to recuperate.\\\\n\\\\nTeens using fake weed can become paranoid, on edge, agitated and aggressive toward parents and family members.\\\\n\\\\nJoin the conversation See the latest news and share your comments with CNN Health on Facebook and Twitter.\\\\n\\\\n\"It\\\\\\'s a different kind of psychosis than we might see with other patients. The psychosis is an agitated psychosis,\" Krakower said. \"They\\\\\\'re violent. They can become aggressive. It is very scary, if you\\\\\\'ve ever seen these kids on it.\\\\n\\\\n\"And coming off of it is very, very scary, too. It takes them a few days sometimes to get rid of the paranoia. Sometimes, they\\\\\\'ll be paranoid for like 48, 72 hours.\"\\\\n\\\\nKrakower said the substance emerges in waves while drug officials and test kits try to keep up with changing formulations.\\\\n\\\\nUsually, he tells that parents the warning signs for synthetic cannabinoid use include a child with a history of substance use and drug tests that come back negative even when the child appears high.\\\\n\\\\n\"And if they are using synthetic agents, that\\\\\\'s pretty serious, and they should definitely seek help from a professional,\" Krakower said, whether it\\\\\\'s an addiction specialist or even a trusted pediatrician who might guide them through the crisis. \"There\\\\\\'s a lot of ways to tackle this.\"\\'',\n",
       " 'u\"But those studies had limitations, particularly related to the tendency of people to gravitate toward others who are like them. This phenomenon, which researchers call homophily, makes it difficult to tease out how friends influence each other\\\\u2019s lives. Many of these studies also relied on people\\\\u2019s notoriously unreliable estimations of their behavior, whether it involved eating or exercise.\\\\n\\\\nAdvertisement Continue reading the main story\\\\n\\\\nThe new study, published on Monday in Nature Communications, sought to avoid these pitfalls by turning to data from a worldwide social network devoted to sharing objectively measured exercise routines. (The network is not named in the study for contractual reasons, the researchers say.)\\\\n\\\\nPeople who join this network upload data from an activity monitor, which precisely tracks their daily exercise regimens. They also become virtual friends with others in the network who seem like-minded. Friends then automatically share workout data.\\\\n\\\\nThe researchers, from the Massachusetts Institute of Technology\\\\u2019s Sloan School of Management, eventually gathered five years worth of data from about 1.1 million runners from across the globe. Cumulatively, those in the network had run almost 225 million miles during that time.\\\\n\\\\nThe identity of the individual runners was masked, but the researchers could tally exactly how often, far and fast each had gone every day for five years. They could similarly map out how often, far and fast their particular friends had run on those same and subsequent days.\\\\n\\\\nUsing this data, the researchers noted immediate correlations. Friends tended to display similar training routines day to day and year to year, even if they were separated geographically. But it remained unclear whether the runners were influencing one another\\\\u2019s distance and pace or just hanging out virtually with people who already ran like them.\\\\n\\\\nPlease verify you\\'re not a robot by clicking the box. Invalid email address. Please re-enter. You must select a newsletter to subscribe to. Sign Up Receive occasional updates and special offers for The New York Times\\'s products and services. Thank you for subscribing. An error has occurred. Please try again later. View all New York Times newsletters.\\\\n\\\\nSo the researchers next decided that they should also consider weather. Bad weather can dampen enthusiasm for exercise, the researchers reasoned, so if someone heads out in rotten weather on a day when friends elsewhere have run, the soggy runner presumably has been influenced by what his or her friends had been up to.\\\\n\\\\nConsequently, the researchers also gathered five years\\\\u2019 worth of data from global weather stations and cross-correlated this massive database with information about the 1.1 million runners\\\\u2019 daily workouts.\\\\n\\\\nThe results clearly showed that runners do influence one another, the scientists found. Over all, if one person ran for about 10 minutes more than usual on any given day, that runner\\\\u2019s friends would lengthen their workout by approximately three minutes, even if the weather was discouraging. Similarly, if a friend ran faster than usual, his or her friends would tend to pick up their pace in their runs that same day.\\\\n\\\\nThe effects were most pronounced, the researchers found, if one runner previously had been just a little slower or less in shape than a friend but now showed signs of overtaking a friend\\\\u2019s performance. The threat of falling behind would prod that friend to run a bit harder.\\\\n\\\\nAdvertisement Continue reading the main story\\\\n\\\\nGender also mattered. Men generally ran faster or longer if their male virtual friends had done likewise and also if their female friends had, although not to the same extent. But female runners seemed unaffected by male network friends. They altered their training routines almost exclusively in response to changes among their female friends.\\\\n\\\\nIn aggregate, these results indicate that, with caveats, \\\\u201crunning can be socially contagious,\\\\u201d says Sinan Aral, the David Austin Professor of Management at M.I.T. who led the study.\\\\n\\\\nThe impacts \\\\u201cgo beyond correlation to causation,\\\\u201d he says. \\\\u201cIn general, if you run more, it is likely that you can cause your friends to run more.\\\\u201d\\\\n\\\\nBut the findings apply only to people who already are runners, he adds, since the data he and his colleagues used described runners. They cannot tell us whether other types of exercise are equally catching or how to make exercise in general more palatable and contagious among inactive people.\\\\n\\\\nDr. Aral and his colleagues plan to use other social media data to study those questions soon.\"',\n",
       " \"u'Larry Brandwein, a former special education teacher, was formally given a diagnosis of Type 2 diabetes at the age of 35, but he suspected he had it well before then.\\\\n\\\\nEvery morning, Mr. Brandwein injects himself with insulin to help his body maintain a healthy level of blood sugar. But routine monitoring is a challenge, and he often copes with drops in blood sugar levels. When that happens, Mr. Brandwein gets dizzy and must immediately have something sweet, like orange juice. Too much orange juice, though, can cause a sudden rise in his blood sugar. Such extreme swings can be very damaging to the body.\\\\n\\\\nFive years ago, Mr. Brandwein began to have trouble walking, a result of peripheral neuropathy, a common complication of diabetes that causes pain and numbness in the extremities. This pain, made worse by foot ulcers, forced him to retire from teaching.\\\\n\\\\nMr. Brandwein understands that habits like smoking, overeating and failing to monitor his blood sugar are not good for his health, but he says he lacks the strength to turn them around.'\",\n",
       " \"u'Photo\\\\n\\\\nBeing obese, smoking or having high cholesterol, high blood pressure or diabetes in midlife is associated with an increased risk of dementia later in life. Now researchers have found these five risk factors correlate with the development, years later, of amyloid brain plaques, a hallmark of Alzheimer\\\\u2019s disease.\\\\n\\\\nThe study, in JAMA, evaluated 322 men and women from 1987 to 1989, when their average age was 52. From 2011 to 2013, they used PET scans to measure their level of amyloid plaques.\\\\n\\\\nAfter adjusting for age and other factors, they found that compared with those with no midlife risk factors, those with one had an 88 percent increased risk for elevated levels of plaques, and those with two or more had nearly triple the risk.\\\\n\\\\nThere was no association in those who developed these risk factors later in life or in those with the ApoE4 gene, which also increases risk.\\\\n\\\\nThe lead author, Dr. Rebecca F. Gottesman, an associate professor of neurology at Johns Hopkins, said that amyloid plaque is one factor in Alzheimer\\\\u2019s disease, but not the only one.\\\\n\\\\nWhy this happens is not known. \\\\u201cEither there\\\\u2019s a vulnerable period \\\\u2014 midlife or younger \\\\u2014 or there\\\\u2019s a cumulative effect over the decades.\\\\u201d Dr. Gottesman said. \\\\u201cOr it might be both.\\\\u201d'\",\n",
       " \"u'The Food and Drug Administration has approved a new injectable diabetes drug from Eli Lilly for adults with Type 2, the most common form of the disease. The agency on Thursday cleared the drug, Trulicity, as a weekly injection to improve blood sugar control in patients with Type 2 diabetes, which affects over 26 million Americans or about 90 percent of the cases in the United States. The drug is part of a new class of medicines called GLP-1 agonists, which spur the pancreas to create extra insulin after meals. The F.D.A. approved Trulicity based on six studies in 3,342 patients that showed improvements in blood sugar control. The drug will bear a boxed warning highlighting that rats tested with Trulicity had cases of thyroid cancer, though it is unclear whether they were caused by the drug. Lilly will be required to conduct follow-up studies.'\"]"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "body = open('news.txt').read().split('\\n')\n",
    "\n",
    "body[:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "comments = [x.decode('UTF-8','ignore') for x in body]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'30'"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str(len(comments))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# generates index for each item in the corpora (in this case it's just rank) and I'll use this for scoring later\n",
    "ranks = []\n",
    "\n",
    "for i in range(0,len(comments)):\n",
    "    ranks.append(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "stopwords = nltk.corpus.stopwords.words('english')\n",
    "stopwords.extend(['diabetes','use','said','say','says'])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "stemmer = nltk.PorterStemmer()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def tokenize_and_stem(text):\n",
    "    # first tokenize by sentence, then by word to ensure that punctuation is caught as it's own token\n",
    "    tokens = [word for sent in nltk.sent_tokenize(text) for word in nltk.word_tokenize(sent)]\n",
    "    words = [w.lower() for w in tokens if w.isalpha() if w.lower()not in stopwords]\n",
    "    filtered_tokens = []\n",
    "    # filter out any tokens not containing letters (e.g., numeric tokens, raw punctuation)\n",
    "    for token in words:\n",
    "        if re.search('[a-zA-Z]', token):\n",
    "            filtered_tokens.append(token)\n",
    "    stems = [stemmer.stem(t) for t in filtered_tokens]\n",
    "    return stems\n",
    "\n",
    "\n",
    "def tokenize_only(text):\n",
    "    # first tokenize by sentence, then by word to ensure that punctuation is caught as it's own token\n",
    "    tokens = [word.lower() for sent in nltk.sent_tokenize(text) for word in nltk.word_tokenize(sent)]\n",
    "    words = [w.lower() for w in tokens if w.isalpha() if w.lower()not in stopwords]\n",
    "    filtered_tokens = []\n",
    "    # filter out any tokens not containing letters (e.g., numeric tokens, raw punctuation)\n",
    "    for token in words:\n",
    "        if re.search('[a-zA-Z]', token):\n",
    "            filtered_tokens.append(token)\n",
    "    return filtered_tokens"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "totalvocab_stemmed = []\n",
    "totalvocab_tokenized = []\n",
    "for i in comments:\n",
    "    allwords_stemmed = tokenize_and_stem(i) #for each item in 'synopses', tokenize/stem\n",
    "    totalvocab_stemmed.extend(allwords_stemmed) #extend the 'totalvocab_stemmed' list\n",
    "    \n",
    "    allwords_tokenized = tokenize_only(i)\n",
    "    totalvocab_tokenized.extend(allwords_tokenized)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "vocab_frame = pd.DataFrame({'words': totalvocab_tokenized}, index = totalvocab_stemmed)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Tf-idf and document similarity¶"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wall time: 628 ms\n"
     ]
    }
   ],
   "source": [
    "from sklearn.feature_extraction.text import TfidfVectorizer\n",
    "\n",
    "tfidf_vectorizer = TfidfVectorizer(max_df=0.99, max_features=200000,\n",
    "                                 min_df=0.3, stop_words='english',\n",
    "                                 use_idf=True, tokenizer=tokenize_and_stem, ngram_range=(1,3))\n",
    "\n",
    "%time tfidf_matrix = tfidf_vectorizer.fit_transform(comments)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "terms = tfidf_vectorizer.get_feature_names()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[u'accord',\n",
       " u'ad',\n",
       " u'adult',\n",
       " u'affect',\n",
       " u'associ',\n",
       " u'becom',\n",
       " u'blood',\n",
       " u'blood glucos',\n",
       " u'blood glucos level',\n",
       " u'blood sugar',\n",
       " u'bodi',\n",
       " u'care',\n",
       " u'caus',\n",
       " u'chang',\n",
       " u'condit',\n",
       " u'consid',\n",
       " u'continu',\n",
       " u'control',\n",
       " u'damag',\n",
       " u'data',\n",
       " u'day',\n",
       " u'develop',\n",
       " u'diabet',\n",
       " u'diet',\n",
       " u'diseas',\n",
       " u'doctor',\n",
       " u'drink',\n",
       " u'drug',\n",
       " u'eat',\n",
       " u'effect',\n",
       " u'especi',\n",
       " u'factor',\n",
       " u'food',\n",
       " u'gener',\n",
       " u'glucos',\n",
       " u'glucos level',\n",
       " u'health',\n",
       " u'healthi',\n",
       " u'heart',\n",
       " u'help',\n",
       " u'high',\n",
       " u'hospit',\n",
       " u'import',\n",
       " u'includ',\n",
       " u'increas',\n",
       " u'inform',\n",
       " u'insulin',\n",
       " u'know',\n",
       " u'lead',\n",
       " u'level',\n",
       " u'like',\n",
       " u'limit',\n",
       " u'live',\n",
       " u'look',\n",
       " u'make',\n",
       " u'manag',\n",
       " u'mani',\n",
       " u'medic',\n",
       " u'medicin',\n",
       " u'million',\n",
       " u'need',\n",
       " u'new',\n",
       " u'number',\n",
       " u'obes',\n",
       " u'patient',\n",
       " u'peopl',\n",
       " u'plan',\n",
       " u'prevent',\n",
       " u'produc',\n",
       " u'research',\n",
       " u'result',\n",
       " u'risk',\n",
       " u'sever',\n",
       " u'start',\n",
       " u'studi',\n",
       " u'sugar',\n",
       " u'sure',\n",
       " u'test',\n",
       " u'time',\n",
       " u'treat',\n",
       " u'treatment',\n",
       " u'tri',\n",
       " u'type',\n",
       " u'univers',\n",
       " u'use',\n",
       " u'weight',\n",
       " u'work',\n",
       " u'year']"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "terms"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from sklearn.metrics.pairwise import cosine_similarity\n",
    "dist = 1 - cosine_similarity(tfidf_matrix)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# K-means clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wall time: 58 ms\n"
     ]
    }
   ],
   "source": [
    "from sklearn.cluster import KMeans\n",
    "\n",
    "num_clusters =5\n",
    "\n",
    "km = KMeans(n_clusters=num_clusters)\n",
    "\n",
    "%time km.fit(tfidf_matrix)\n",
    "\n",
    "clusters = km.labels_.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.externals import joblib\n",
    "\n",
    "joblib.dump(km,  'doc_cluster.pkl')\n",
    "km = joblib.load('doc_cluster.pkl')\n",
    "clusters = km.labels_.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Rank</th>\n",
       "      <th>cluster</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Rank  cluster\n",
       "3     0        3\n",
       "3     1        3\n",
       "2     2        2\n",
       "3     3        3\n",
       "1     4        1"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "VA = { 'Rank':ranks, 'Content':comments, 'cluster': clusters }\n",
    "\n",
    "frame = pd.DataFrame(VA, index = [clusters] , columns = ['Rank','cluster'])\n",
    "frame.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2    12\n",
       "3     7\n",
       "0     5\n",
       "1     4\n",
       "4     2\n",
       "Name: cluster, dtype: int64"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "frame['cluster'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Top terms per cluster:\n",
      "\n",
      "Cluster 0 words: hospital, people, patients, treating, types, care,\n",
      "\n",
      "Cluster 1 words: medical, drugs, patients, doctoral, study, blood,\n",
      "\n",
      "Cluster 2 words: glucose, blood, insulin, blood, people, level,\n",
      "\n",
      "Cluster 3 words: study, used, research, risk, people, factors,\n",
      "\n",
      "Cluster 4 words: million, number, disease, new, prevention, people,\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from __future__ import print_function\n",
    "\n",
    "print(\"Top terms per cluster:\")\n",
    "print()\n",
    "order_centroids = km.cluster_centers_.argsort()[:, ::-1]\n",
    "for i in range(num_clusters):\n",
    "    print(\"Cluster %d words:\" % i, end='')\n",
    "    for ind in order_centroids[i, :6]:\n",
    "        print(' %s' % vocab_frame.ix[terms[ind].split(' ')].values.tolist()[0][0].encode('utf-8', 'ignore'), end=',')\n",
    "    print()\n",
    "    print()\n",
    "    #print(\"Cluster %d titles:\" % i, end='')\n",
    "    #for title in frame.ix[i]['Title'].values.tolist():\n",
    "        #print(' %s,' % title, end='')\n",
    "    #print()\n",
    "    #print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import matplotlib as mpl\n",
    "\n",
    "from sklearn.manifold import MDS\n",
    "\n",
    "MDS()\n",
    "\n",
    "# two components as we're plotting points in a two-dimensional plane\n",
    "# \"precomputed\" because we provide a distance matrix\n",
    "# we will also specify `random_state` so the plot is reproducible.\n",
    "mds = MDS(n_components=2, dissimilarity=\"precomputed\",n_jobs=-2)\n",
    "\n",
    "pos = mds.fit_transform(dist)  # shape (n_components, n_samples)\n",
    "\n",
    "xs, ys = pos[:, 0], pos[:, 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "#set up colors per clusters using a dict\n",
    "cluster_colors = {0: '#1b9e77', 1: '#d95f02', 2: '#7570b3', 3: '#e7298a', 4: '#66a61e'}\n",
    "\n",
    "#set up cluster names using a dict\n",
    "cluster_names = {0: 'hospital, people, patients, treating, types, care', \n",
    "                 1: 'medical, drugs, patients, doctoral, study, blood',\n",
    "                 2: 'glucose, blood, insulin, blood, people, level',\n",
    "                 3: 'study, used, research, risk, people, factors',\n",
    "                 4: 'million, number, disease, new, prevention, people'\n",
    "                 }\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "#create data frame that has the result of the MDS plus the cluster numbers and titles\n",
    "df = pd.DataFrame(dict(x=xs, y=ys, label=clusters, title=ranks)) \n",
    "\n",
    "#group by cluster\n",
    "groups = df.groupby('label')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>label</th>\n",
       "      <th>title</th>\n",
       "      <th>x</th>\n",
       "      <th>y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0.499284</td>\n",
       "      <td>-0.169480</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0.458298</td>\n",
       "      <td>0.371083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>-0.131519</td>\n",
       "      <td>-0.590190</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>0.311212</td>\n",
       "      <td>-0.607585</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "      <td>-0.361328</td>\n",
       "      <td>0.406773</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   label  title         x         y\n",
       "0      3      0  0.499284 -0.169480\n",
       "1      3      1  0.458298  0.371083\n",
       "2      2      2 -0.131519 -0.590190\n",
       "3      3      3  0.311212 -0.607585\n",
       "4      1      4 -0.361328  0.406773"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# set up plot\n",
    "fig, ax = plt.subplots(figsize=(17, 9)) # set size\n",
    "ax.margins(0.05) # Optional, just adds 5% padding to the autoscaling\n",
    "\n",
    "#iterate through groups to layer the plot\n",
    "#note that I use the cluster_name and cluster_color dicts with the 'name' lookup to return the appropriate color/label\n",
    "for name, group in groups:\n",
    "    ax.plot(group.x, group.y, marker='o', linestyle='', ms=12, label=cluster_names.get(name), color=cluster_colors.get(name), mec='none')\n",
    "    ax.set_aspect('auto')\n",
    "    ax.tick_params(\\\n",
    "        axis= 'x',          # changes apply to the x-axis\n",
    "        which='both',      # both major and minor ticks are affected\n",
    "        bottom='off',      # ticks along the bottom edge are off\n",
    "        top='off',         # ticks along the top edge are off\n",
    "        labelbottom='off')\n",
    "    ax.tick_params(\\\n",
    "        axis= 'y',         # changes apply to the y-axis\n",
    "        which='both',      # both major and minor ticks are affected\n",
    "        left='off',      # ticks along the bottom edge are off\n",
    "        top='off',         # ticks along the top edge are off\n",
    "        labelleft='off')\n",
    "    \n",
    "ax.legend(numpoints=1)  #show legend with only 1 point\n",
    "\n",
    "#add label in x,y position with the label as the film title\n",
    "for i in range(len(df)):\n",
    "    ax.text(df.ix[i]['x'], df.ix[i]['y'], df.ix[i]['title'], size=8)  \n",
    "\n",
    "    \n",
    "    \n",
    "#plt.show() #show the plot\n",
    "\n",
    "#uncomment the below to save the plot if need be\n",
    "#plt.savefig('clusters_small_noaxes.png', dpi=200)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#define custom toolbar location\n",
    "class TopToolbar(mpld3.plugins.PluginBase):\n",
    "    \"\"\"Plugin for moving toolbar to top of figure\"\"\"\n",
    "\n",
    "    JAVASCRIPT = \"\"\"\n",
    "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
    "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
    "    TopToolbar.prototype.constructor = TopToolbar;\n",
    "    function TopToolbar(fig, props){\n",
    "        mpld3.Plugin.call(this, fig, props);\n",
    "    };\n",
    "\n",
    "    TopToolbar.prototype.draw = function(){\n",
    "      // the toolbar svg doesn't exist\n",
    "      // yet, so first draw it\n",
    "      this.fig.toolbar.draw();\n",
    "\n",
    "      // then change the y position to be\n",
    "      // at the top of the figure\n",
    "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
    "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
    "\n",
    "      // then remove the draw function,\n",
    "      // so that it is not called again\n",
    "      this.fig.toolbar.draw = function() {}\n",
    "    }\n",
    "    \"\"\"\n",
    "    def __init__(self):\n",
    "        self.dict_ = {\"type\": \"toptoolbar\"}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "<style>\n",
       "\n",
       "text.mpld3-text, div.mpld3-tooltip {\n",
       "  font-family:Arial, Helvetica, sans-serif;\n",
       "}\n",
       "\n",
       "g.mpld3-xaxis, g.mpld3-yaxis {\n",
       "display: none; }\n",
       "\n",
       "svg.mpld3-figure {\n",
       "margin-left: -200px;}\n",
       "\n",
       "text.mpld3-text, div.mpld3-tooltip {\n",
       "  font-family:Arial, Helvetica, sans-serif;\n",
       "}\n",
       "\n",
       "g.mpld3-xaxis, g.mpld3-yaxis {\n",
       "display: none; }\n",
       "\n",
       "svg.mpld3-figure {\n",
       "margin-left: -200px;}\n",
       "\n",
       "text.mpld3-text, div.mpld3-tooltip {\n",
       "  font-family:Arial, Helvetica, sans-serif;\n",
       "}\n",
       "\n",
       "g.mpld3-xaxis, g.mpld3-yaxis {\n",
       "display: none; }\n",
       "\n",
       "svg.mpld3-figure {\n",
       "margin-left: -200px;}\n",
       "\n",
       "text.mpld3-text, div.mpld3-tooltip {\n",
       "  font-family:Arial, Helvetica, sans-serif;\n",
       "}\n",
       "\n",
       "g.mpld3-xaxis, g.mpld3-yaxis {\n",
       "display: none; }\n",
       "\n",
       "svg.mpld3-figure {\n",
       "margin-left: -200px;}\n",
       "\n",
       "text.mpld3-text, div.mpld3-tooltip {\n",
       "  font-family:Arial, Helvetica, sans-serif;\n",
       "}\n",
       "\n",
       "g.mpld3-xaxis, g.mpld3-yaxis {\n",
       "display: none; }\n",
       "\n",
       "svg.mpld3-figure {\n",
       "margin-left: -200px;}\n",
       "\n",
       "</style>\n",
       "\n",
       "<div id=\"fig_el13684345335064395671980\"></div>\n",
       "<script>\n",
       "function mpld3_load_lib(url, callback){\n",
       "  var s = document.createElement('script');\n",
       "  s.src = url;\n",
       "  s.async = true;\n",
       "  s.onreadystatechange = s.onload = callback;\n",
       "  s.onerror = function(){console.warn(\"failed to load library \" + url);};\n",
       "  document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "}\n",
       "\n",
       "if(typeof(mpld3) !== \"undefined\" && mpld3._mpld3IsLoaded){\n",
       "   // already loaded: just create the figure\n",
       "   !function(mpld3){\n",
       "       \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "       mpld3.draw_figure(\"fig_el13684345335064395671980\", {\"axes\": [{\"xlim\": [-0.6369602352612876, 0.5504612283987562], \"yscale\": \"linear\", \"axesbg\": \"#FFFFFF\", \"texts\": [{\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"hospital, people, patients, treating, types, care\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.9478783419180772], \"rotation\": -0.0, \"id\": \"el13684353297128\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"medical, drugs, patients, doctoral, study, blood\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.901888643610498], \"rotation\": -0.0, \"id\": \"el13684353299368\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"glucose, blood, insulin, blood, people, level\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.8558989453029189], \"rotation\": -0.0, \"id\": \"el13684353354248\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"study, used, research, risk, people, factors\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.8099092469953398], \"rotation\": -0.0, \"id\": \"el13684353356488\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"million, number, disease, new, prevention, people\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.7639195486877607], \"rotation\": -0.0, \"id\": \"el13684355038152\"}], \"zoomable\": true, \"images\": [], \"xdomain\": [-0.6369602352612876, 0.5504612283987562], \"ylim\": [-0.6475430948708354, 0.7643134101299636], \"paths\": [{\"edgecolor\": \"#CCCCCC\", \"facecolor\": \"#FFFFFF\", \"edgewidth\": 1.0, \"pathcodes\": [\"M\", \"L\", \"S\", \"L\", \"S\", \"L\", \"S\", \"L\", \"S\", \"Z\"], \"yindex\": 1, \"coordinates\": \"axes\", \"dasharray\": \"none\", \"zorder\": 1000000.0, \"alpha\": 0.8, \"xindex\": 0, \"data\": \"data07\", \"id\": \"el13684353210664\"}], \"sharey\": [], \"sharex\": [], \"axesbgalpha\": null, \"axes\": [{\"scale\": \"linear\", \"tickformat\": \"\", \"grid\": {\"gridOn\": false}, \"visible\": false, \"fontsize\": null, \"position\": \"bottom\", \"nticks\": 0, \"tickvalues\": []}, {\"scale\": \"linear\", \"tickformat\": \"\", \"grid\": {\"gridOn\": false}, \"visible\": false, \"fontsize\": null, \"position\": \"left\", \"nticks\": 0, \"tickvalues\": []}], \"lines\": [], \"markers\": [{\"edgecolor\": \"none\", \"facecolor\": \"#1B9E77\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data01\", \"id\": \"el13684341747080pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#D95F02\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data02\", \"id\": \"el13684353210832pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#7570B3\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data03\", \"id\": \"el13684341748424pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#E7298A\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data04\", \"id\": \"el13684353066456pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#66A61E\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data05\", \"id\": \"el13684353214248pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#1B9E77\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353298360pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#D95F02\", \"edgewidth\": 1.0, \"yindex\": 2, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353299928pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#7570B3\", \"edgewidth\": 1.0, \"yindex\": 3, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353355480pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#E7298A\", \"edgewidth\": 1.0, \"yindex\": 4, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353357720pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#66A61E\", \"edgewidth\": 1.0, \"yindex\": 5, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353357272pts\"}], \"id\": \"el13684353043568\", \"ydomain\": [-0.6475430948708354, 0.7643134101299636], \"collections\": [], \"xscale\": \"linear\", \"bbox\": [0.125, 0.125, 0.775, 0.755]}], \"height\": 432.0, \"width\": 1008.0, \"plugins\": [{\"type\": \"reset\"}, {\"enabled\": false, \"button\": true, \"type\": \"zoom\"}, {\"enabled\": false, \"button\": true, \"type\": \"boxzoom\"}, {\"voffset\": 10, \"labels\": [8, 18, 20, 22, 23], \"type\": \"htmltooltip\", \"id\": \"el13684341747080pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [4, 10, 13, 28], \"type\": \"htmltooltip\", \"id\": \"el13684353210832pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [2, 6, 11, 14, 15, 16, 17, 21, 24, 25, 27, 29], \"type\": \"htmltooltip\", \"id\": \"el13684341748424pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [0, 1, 3, 9, 12, 19, 26], \"type\": \"htmltooltip\", \"id\": \"el13684353066456pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [5, 7], \"type\": \"htmltooltip\", \"id\": \"el13684353214248pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}], \"data\": {\"data06\": [[0.024321556579621102, 0.958609271523179, 0.9126195732155998, 0.8666298749080207, 0.8206401766004416, 0.7746504782928625]], \"data07\": [[0.00896057347670251, 0.745523669364729], [0.36994367639528936, 0.745523669364729], [0.37250384024577576, 0.745523669364729], [0.37250384024577576, 0.7516556291390729], [0.37250384024577576, 0.9785381407897964], [0.37250384024577576, 0.9846701005641403], [0.36994367639528936, 0.9846701005641403], [0.00896057347670251, 0.9846701005641403], [0.006400409626216075, 0.9846701005641403], [0.006400409626216075, 0.9785381407897964], [0.006400409626216075, 0.7516556291390729], [0.006400409626216075, 0.745523669364729], [0.00896057347670251, 0.745523669364729]], \"data04\": [[0.49928443238548603, -0.1694796444939049], [0.458297780881153, 0.37108284520334767], [0.3112122496510288, -0.6075848918991147], [0.17225085507906643, -0.0849074345631109], [0.1722508550791458, -0.08490743456326182], [0.3628069214367388, -0.09867844724883472], [0.2090849341531242, -0.3515070017068644]], \"data05\": [[0.10565921678918312, 0.7243552071582429], [0.4568760091741914, 0.24645098911406477]], \"data02\": [[-0.3613279373220611, 0.406773425911952], [-0.6033539674218524, 0.16172718501793376], [-0.2700360502754518, 0.06588558363625348], [-0.4046674789585665, 0.2880326534972822]], \"data03\": [[-0.13151930072499504, -0.5901904536754657], [-0.023285440387956255, -0.21806168092804795], [-0.2198590116318884, -0.3136908000217697], [-0.26855457777588326, -0.3675065345234401], [-0.504662617081419, -0.25055058959579213], [-0.1398373309327802, -0.08196097511000901], [-0.4656077407467645, -0.07403275903271248], [0.11401605008350967, 0.33608140090911975], [-0.05530216804601401, 0.42305835860644336], [-0.42112414021653716, -0.3336614422505189], [-0.31819992457764185, -0.13549604598184567], [-0.05927617716384019, -0.33613639870863943]], \"data01\": [[0.17673396043028755, 0.19989705780380881], [0.38101742125415056, 0.5657890818747127], [0.4931665569217588, -0.4183829439618557], [-0.18289834061449373, 0.6310046002008394], [0.516854960559321, 0.09659708933118849]]}, \"id\": \"el13684345335064\"});\n",
       "   }(mpld3);\n",
       "}else if(typeof define === \"function\" && define.amd){\n",
       "   // require.js is available: use it to load d3/mpld3\n",
       "   require.config({paths: {d3: \"https://mpld3.github.io/js/d3.v3.min\"}});\n",
       "   require([\"d3\"], function(d3){\n",
       "      window.d3 = d3;\n",
       "      mpld3_load_lib(\"https://mpld3.github.io/js/mpld3.v0.3.js\", function(){\n",
       "         \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "         mpld3.draw_figure(\"fig_el13684345335064395671980\", {\"axes\": [{\"xlim\": [-0.6369602352612876, 0.5504612283987562], \"yscale\": \"linear\", \"axesbg\": \"#FFFFFF\", \"texts\": [{\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"hospital, people, patients, treating, types, care\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.9478783419180772], \"rotation\": -0.0, \"id\": \"el13684353297128\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"medical, drugs, patients, doctoral, study, blood\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.901888643610498], \"rotation\": -0.0, \"id\": \"el13684353299368\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"glucose, blood, insulin, blood, people, level\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.8558989453029189], \"rotation\": -0.0, \"id\": \"el13684353354248\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"study, used, research, risk, people, factors\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.8099092469953398], \"rotation\": -0.0, \"id\": \"el13684353356488\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"million, number, disease, new, prevention, people\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.7639195486877607], \"rotation\": -0.0, \"id\": \"el13684355038152\"}], \"zoomable\": true, \"images\": [], \"xdomain\": [-0.6369602352612876, 0.5504612283987562], \"ylim\": [-0.6475430948708354, 0.7643134101299636], \"paths\": [{\"edgecolor\": \"#CCCCCC\", \"facecolor\": \"#FFFFFF\", \"edgewidth\": 1.0, \"pathcodes\": [\"M\", \"L\", \"S\", \"L\", \"S\", \"L\", \"S\", \"L\", \"S\", \"Z\"], \"yindex\": 1, \"coordinates\": \"axes\", \"dasharray\": \"none\", \"zorder\": 1000000.0, \"alpha\": 0.8, \"xindex\": 0, \"data\": \"data07\", \"id\": \"el13684353210664\"}], \"sharey\": [], \"sharex\": [], \"axesbgalpha\": null, \"axes\": [{\"scale\": \"linear\", \"tickformat\": \"\", \"grid\": {\"gridOn\": false}, \"visible\": false, \"fontsize\": null, \"position\": \"bottom\", \"nticks\": 0, \"tickvalues\": []}, {\"scale\": \"linear\", \"tickformat\": \"\", \"grid\": {\"gridOn\": false}, \"visible\": false, \"fontsize\": null, \"position\": \"left\", \"nticks\": 0, \"tickvalues\": []}], \"lines\": [], \"markers\": [{\"edgecolor\": \"none\", \"facecolor\": \"#1B9E77\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data01\", \"id\": \"el13684341747080pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#D95F02\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data02\", \"id\": \"el13684353210832pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#7570B3\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data03\", \"id\": \"el13684341748424pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#E7298A\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data04\", \"id\": \"el13684353066456pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#66A61E\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data05\", \"id\": \"el13684353214248pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#1B9E77\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353298360pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#D95F02\", \"edgewidth\": 1.0, \"yindex\": 2, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353299928pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#7570B3\", \"edgewidth\": 1.0, \"yindex\": 3, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353355480pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#E7298A\", \"edgewidth\": 1.0, \"yindex\": 4, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353357720pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#66A61E\", \"edgewidth\": 1.0, \"yindex\": 5, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353357272pts\"}], \"id\": \"el13684353043568\", \"ydomain\": [-0.6475430948708354, 0.7643134101299636], \"collections\": [], \"xscale\": \"linear\", \"bbox\": [0.125, 0.125, 0.775, 0.755]}], \"height\": 432.0, \"width\": 1008.0, \"plugins\": [{\"type\": \"reset\"}, {\"enabled\": false, \"button\": true, \"type\": \"zoom\"}, {\"enabled\": false, \"button\": true, \"type\": \"boxzoom\"}, {\"voffset\": 10, \"labels\": [8, 18, 20, 22, 23], \"type\": \"htmltooltip\", \"id\": \"el13684341747080pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [4, 10, 13, 28], \"type\": \"htmltooltip\", \"id\": \"el13684353210832pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [2, 6, 11, 14, 15, 16, 17, 21, 24, 25, 27, 29], \"type\": \"htmltooltip\", \"id\": \"el13684341748424pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [0, 1, 3, 9, 12, 19, 26], \"type\": \"htmltooltip\", \"id\": \"el13684353066456pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [5, 7], \"type\": \"htmltooltip\", \"id\": \"el13684353214248pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}], \"data\": {\"data06\": [[0.024321556579621102, 0.958609271523179, 0.9126195732155998, 0.8666298749080207, 0.8206401766004416, 0.7746504782928625]], \"data07\": [[0.00896057347670251, 0.745523669364729], [0.36994367639528936, 0.745523669364729], [0.37250384024577576, 0.745523669364729], [0.37250384024577576, 0.7516556291390729], [0.37250384024577576, 0.9785381407897964], [0.37250384024577576, 0.9846701005641403], [0.36994367639528936, 0.9846701005641403], [0.00896057347670251, 0.9846701005641403], [0.006400409626216075, 0.9846701005641403], [0.006400409626216075, 0.9785381407897964], [0.006400409626216075, 0.7516556291390729], [0.006400409626216075, 0.745523669364729], [0.00896057347670251, 0.745523669364729]], \"data04\": [[0.49928443238548603, -0.1694796444939049], [0.458297780881153, 0.37108284520334767], [0.3112122496510288, -0.6075848918991147], [0.17225085507906643, -0.0849074345631109], [0.1722508550791458, -0.08490743456326182], [0.3628069214367388, -0.09867844724883472], [0.2090849341531242, -0.3515070017068644]], \"data05\": [[0.10565921678918312, 0.7243552071582429], [0.4568760091741914, 0.24645098911406477]], \"data02\": [[-0.3613279373220611, 0.406773425911952], [-0.6033539674218524, 0.16172718501793376], [-0.2700360502754518, 0.06588558363625348], [-0.4046674789585665, 0.2880326534972822]], \"data03\": [[-0.13151930072499504, -0.5901904536754657], [-0.023285440387956255, -0.21806168092804795], [-0.2198590116318884, -0.3136908000217697], [-0.26855457777588326, -0.3675065345234401], [-0.504662617081419, -0.25055058959579213], [-0.1398373309327802, -0.08196097511000901], [-0.4656077407467645, -0.07403275903271248], [0.11401605008350967, 0.33608140090911975], [-0.05530216804601401, 0.42305835860644336], [-0.42112414021653716, -0.3336614422505189], [-0.31819992457764185, -0.13549604598184567], [-0.05927617716384019, -0.33613639870863943]], \"data01\": [[0.17673396043028755, 0.19989705780380881], [0.38101742125415056, 0.5657890818747127], [0.4931665569217588, -0.4183829439618557], [-0.18289834061449373, 0.6310046002008394], [0.516854960559321, 0.09659708933118849]]}, \"id\": \"el13684345335064\"});\n",
       "      });\n",
       "    });\n",
       "}else{\n",
       "    // require.js not available: dynamically load d3 & mpld3\n",
       "    mpld3_load_lib(\"https://mpld3.github.io/js/d3.v3.min.js\", function(){\n",
       "         mpld3_load_lib(\"https://mpld3.github.io/js/mpld3.v0.3.js\", function(){\n",
       "                 \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "    mpld3.register_plugin(\"htmltooltip\", HtmlTooltipPlugin);\n",
       "    HtmlTooltipPlugin.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    HtmlTooltipPlugin.prototype.constructor = HtmlTooltipPlugin;\n",
       "    HtmlTooltipPlugin.prototype.requiredProps = [\"id\"];\n",
       "    HtmlTooltipPlugin.prototype.defaultProps = {labels:null,\n",
       "                                                hoffset:0,\n",
       "                                                voffset:10};\n",
       "    function HtmlTooltipPlugin(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    HtmlTooltipPlugin.prototype.draw = function(){\n",
       "       var obj = mpld3.get_element(this.props.id);\n",
       "       var labels = this.props.labels;\n",
       "       var tooltip = d3.select(\"body\").append(\"div\")\n",
       "                    .attr(\"class\", \"mpld3-tooltip\")\n",
       "                    .style(\"position\", \"absolute\")\n",
       "                    .style(\"z-index\", \"10\")\n",
       "                    .style(\"visibility\", \"hidden\");\n",
       "\n",
       "       obj.elements()\n",
       "           .on(\"mouseover\", function(d, i){\n",
       "                              tooltip.html(labels[i])\n",
       "                                     .style(\"visibility\", \"visible\");})\n",
       "           .on(\"mousemove\", function(d, i){\n",
       "                  tooltip\n",
       "                    .style(\"top\", d3.event.pageY + this.props.voffset + \"px\")\n",
       "                    .style(\"left\",d3.event.pageX + this.props.hoffset + \"px\");\n",
       "                 }.bind(this))\n",
       "           .on(\"mouseout\",  function(d, i){\n",
       "                           tooltip.style(\"visibility\", \"hidden\");});\n",
       "    };\n",
       "    \n",
       "    mpld3.register_plugin(\"toptoolbar\", TopToolbar);\n",
       "    TopToolbar.prototype = Object.create(mpld3.Plugin.prototype);\n",
       "    TopToolbar.prototype.constructor = TopToolbar;\n",
       "    function TopToolbar(fig, props){\n",
       "        mpld3.Plugin.call(this, fig, props);\n",
       "    };\n",
       "\n",
       "    TopToolbar.prototype.draw = function(){\n",
       "      // the toolbar svg doesn't exist\n",
       "      // yet, so first draw it\n",
       "      this.fig.toolbar.draw();\n",
       "\n",
       "      // then change the y position to be\n",
       "      // at the top of the figure\n",
       "      this.fig.toolbar.toolbar.attr(\"x\", 150);\n",
       "      this.fig.toolbar.toolbar.attr(\"y\", 400);\n",
       "\n",
       "      // then remove the draw function,\n",
       "      // so that it is not called again\n",
       "      this.fig.toolbar.draw = function() {}\n",
       "    }\n",
       "    \n",
       "                 mpld3.draw_figure(\"fig_el13684345335064395671980\", {\"axes\": [{\"xlim\": [-0.6369602352612876, 0.5504612283987562], \"yscale\": \"linear\", \"axesbg\": \"#FFFFFF\", \"texts\": [{\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"hospital, people, patients, treating, types, care\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.9478783419180772], \"rotation\": -0.0, \"id\": \"el13684353297128\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"medical, drugs, patients, doctoral, study, blood\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.901888643610498], \"rotation\": -0.0, \"id\": \"el13684353299368\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"glucose, blood, insulin, blood, people, level\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.8558989453029189], \"rotation\": -0.0, \"id\": \"el13684353354248\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"study, used, research, risk, people, factors\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.8099092469953398], \"rotation\": -0.0, \"id\": \"el13684353356488\"}, {\"v_baseline\": \"auto\", \"h_anchor\": \"start\", \"color\": \"#000000\", \"text\": \"million, number, disease, new, prevention, people\", \"coordinates\": \"axes\", \"zorder\": 1000003.0, \"alpha\": 1, \"fontsize\": 10.0, \"position\": [0.04736303123399899, 0.7639195486877607], \"rotation\": -0.0, \"id\": \"el13684355038152\"}], \"zoomable\": true, \"images\": [], \"xdomain\": [-0.6369602352612876, 0.5504612283987562], \"ylim\": [-0.6475430948708354, 0.7643134101299636], \"paths\": [{\"edgecolor\": \"#CCCCCC\", \"facecolor\": \"#FFFFFF\", \"edgewidth\": 1.0, \"pathcodes\": [\"M\", \"L\", \"S\", \"L\", \"S\", \"L\", \"S\", \"L\", \"S\", \"Z\"], \"yindex\": 1, \"coordinates\": \"axes\", \"dasharray\": \"none\", \"zorder\": 1000000.0, \"alpha\": 0.8, \"xindex\": 0, \"data\": \"data07\", \"id\": \"el13684353210664\"}], \"sharey\": [], \"sharex\": [], \"axesbgalpha\": null, \"axes\": [{\"scale\": \"linear\", \"tickformat\": \"\", \"grid\": {\"gridOn\": false}, \"visible\": false, \"fontsize\": null, \"position\": \"bottom\", \"nticks\": 0, \"tickvalues\": []}, {\"scale\": \"linear\", \"tickformat\": \"\", \"grid\": {\"gridOn\": false}, \"visible\": false, \"fontsize\": null, \"position\": \"left\", \"nticks\": 0, \"tickvalues\": []}], \"lines\": [], \"markers\": [{\"edgecolor\": \"none\", \"facecolor\": \"#1B9E77\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data01\", \"id\": \"el13684341747080pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#D95F02\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data02\", \"id\": \"el13684353210832pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#7570B3\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data03\", \"id\": \"el13684341748424pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#E7298A\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data04\", \"id\": \"el13684353066456pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#66A61E\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"data\", \"zorder\": 2, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data05\", \"id\": \"el13684353214248pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#1B9E77\", \"edgewidth\": 1.0, \"yindex\": 1, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353298360pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#D95F02\", \"edgewidth\": 1.0, \"yindex\": 2, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353299928pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#7570B3\", \"edgewidth\": 1.0, \"yindex\": 3, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353355480pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#E7298A\", \"edgewidth\": 1.0, \"yindex\": 4, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353357720pts\"}, {\"edgecolor\": \"none\", \"facecolor\": \"#66A61E\", \"edgewidth\": 1.0, \"yindex\": 5, \"coordinates\": \"axes\", \"zorder\": 1000002.0, \"markerpath\": [[[0.0, 9.0], [2.3868279, 9.0], [4.676218837063681, 8.051703224294176], [6.3639610306789285, 6.3639610306789285], [8.051703224294176, 4.676218837063681], [9.0, 2.3868279], [9.0, 0.0], [9.0, -2.3868279], [8.051703224294176, -4.676218837063681], [6.3639610306789285, -6.3639610306789285], [4.676218837063681, -8.051703224294176], [2.3868279, -9.0], [0.0, -9.0], [-2.3868279, -9.0], [-4.676218837063681, -8.051703224294176], [-6.3639610306789285, -6.3639610306789285], [-8.051703224294176, -4.676218837063681], [-9.0, -2.3868279], [-9.0, 0.0], [-9.0, 2.3868279], [-8.051703224294176, 4.676218837063681], [-6.3639610306789285, 6.3639610306789285], [-4.676218837063681, 8.051703224294176], [-2.3868279, 9.0], [0.0, 9.0]], [\"M\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"C\", \"Z\"]], \"alpha\": 1, \"xindex\": 0, \"data\": \"data06\", \"id\": \"el13684353357272pts\"}], \"id\": \"el13684353043568\", \"ydomain\": [-0.6475430948708354, 0.7643134101299636], \"collections\": [], \"xscale\": \"linear\", \"bbox\": [0.125, 0.125, 0.775, 0.755]}], \"height\": 432.0, \"width\": 1008.0, \"plugins\": [{\"type\": \"reset\"}, {\"enabled\": false, \"button\": true, \"type\": \"zoom\"}, {\"enabled\": false, \"button\": true, \"type\": \"boxzoom\"}, {\"voffset\": 10, \"labels\": [8, 18, 20, 22, 23], \"type\": \"htmltooltip\", \"id\": \"el13684341747080pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [4, 10, 13, 28], \"type\": \"htmltooltip\", \"id\": \"el13684353210832pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [2, 6, 11, 14, 15, 16, 17, 21, 24, 25, 27, 29], \"type\": \"htmltooltip\", \"id\": \"el13684341748424pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [0, 1, 3, 9, 12, 19, 26], \"type\": \"htmltooltip\", \"id\": \"el13684353066456pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}, {\"voffset\": 10, \"labels\": [5, 7], \"type\": \"htmltooltip\", \"id\": \"el13684353214248pts\", \"hoffset\": 10}, {\"type\": \"toptoolbar\"}], \"data\": {\"data06\": [[0.024321556579621102, 0.958609271523179, 0.9126195732155998, 0.8666298749080207, 0.8206401766004416, 0.7746504782928625]], \"data07\": [[0.00896057347670251, 0.745523669364729], [0.36994367639528936, 0.745523669364729], [0.37250384024577576, 0.745523669364729], [0.37250384024577576, 0.7516556291390729], [0.37250384024577576, 0.9785381407897964], [0.37250384024577576, 0.9846701005641403], [0.36994367639528936, 0.9846701005641403], [0.00896057347670251, 0.9846701005641403], [0.006400409626216075, 0.9846701005641403], [0.006400409626216075, 0.9785381407897964], [0.006400409626216075, 0.7516556291390729], [0.006400409626216075, 0.745523669364729], [0.00896057347670251, 0.745523669364729]], \"data04\": [[0.49928443238548603, -0.1694796444939049], [0.458297780881153, 0.37108284520334767], [0.3112122496510288, -0.6075848918991147], [0.17225085507906643, -0.0849074345631109], [0.1722508550791458, -0.08490743456326182], [0.3628069214367388, -0.09867844724883472], [0.2090849341531242, -0.3515070017068644]], \"data05\": [[0.10565921678918312, 0.7243552071582429], [0.4568760091741914, 0.24645098911406477]], \"data02\": [[-0.3613279373220611, 0.406773425911952], [-0.6033539674218524, 0.16172718501793376], [-0.2700360502754518, 0.06588558363625348], [-0.4046674789585665, 0.2880326534972822]], \"data03\": [[-0.13151930072499504, -0.5901904536754657], [-0.023285440387956255, -0.21806168092804795], [-0.2198590116318884, -0.3136908000217697], [-0.26855457777588326, -0.3675065345234401], [-0.504662617081419, -0.25055058959579213], [-0.1398373309327802, -0.08196097511000901], [-0.4656077407467645, -0.07403275903271248], [0.11401605008350967, 0.33608140090911975], [-0.05530216804601401, 0.42305835860644336], [-0.42112414021653716, -0.3336614422505189], [-0.31819992457764185, -0.13549604598184567], [-0.05927617716384019, -0.33613639870863943]], \"data01\": [[0.17673396043028755, 0.19989705780380881], [0.38101742125415056, 0.5657890818747127], [0.4931665569217588, -0.4183829439618557], [-0.18289834061449373, 0.6310046002008394], [0.516854960559321, 0.09659708933118849]]}, \"id\": \"el13684345335064\"});\n",
       "            })\n",
       "         });\n",
       "}\n",
       "</script>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#create data frame that has the result of the MDS plus the cluster numbers and titles\n",
    "df = pd.DataFrame(dict(x=xs, y=ys, label=clusters, title=ranks)) \n",
    "\n",
    "#group by cluster\n",
    "groups = df.groupby('label')\n",
    "\n",
    "#define custom css to format the font and to remove the axis labeling\n",
    "css = \"\"\"\n",
    "text.mpld3-text, div.mpld3-tooltip {\n",
    "  font-family:Arial, Helvetica, sans-serif;\n",
    "}\n",
    "\n",
    "g.mpld3-xaxis, g.mpld3-yaxis {\n",
    "display: none; }\n",
    "\n",
    "svg.mpld3-figure {\n",
    "margin-left: -200px;}\n",
    "\"\"\"\n",
    "\n",
    "# Plot \n",
    "fig, ax = plt.subplots(figsize=(14,6)) #set plot size\n",
    "ax.margins(0.03) # Optional, just adds 5% padding to the autoscaling\n",
    "\n",
    "#iterate through groups to layer the plot\n",
    "#note that I use the cluster_name and cluster_color dicts with the 'name' lookup to return the appropriate color/label\n",
    "for name, group in groups:\n",
    "    points = ax.plot(group.x, group.y, marker='o', linestyle='', ms=18,label=cluster_names.get(name), mec='none',color=cluster_colors.get(name))\n",
    "    ax.set_aspect('auto')\n",
    "    Labels = [i for i in group.title]\n",
    "    \n",
    "    \n",
    "    #set tooltip using points, labels and the already defined 'css'\n",
    "    tooltip = mpld3.plugins.PointHTMLTooltip(points[0], Labels,\n",
    "                                       voffset=10, hoffset=10, css=css)\n",
    "    #connect tooltip to fig\n",
    "    mpld3.plugins.connect(fig, tooltip, TopToolbar())    \n",
    "    \n",
    "    #set tick marks as blank\n",
    "    ax.axes.get_xaxis().set_ticks([])\n",
    "    ax.axes.get_yaxis().set_ticks([])\n",
    "    \n",
    "    #set axis as blank\n",
    "    ax.axes.get_xaxis().set_visible(False)\n",
    "    ax.axes.get_yaxis().set_visible(False)\n",
    "\n",
    "    \n",
    "ax.legend(numpoints=1) #show legend with only one dot\n",
    "\n",
    "mpld3.display() #show the plot\n",
    "\n",
    "#uncomment the below to export to html\n",
    "#html = mpld3.fig_to_html(fig)\n",
    "#print(html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
